package sketch.generator;

import java.util.Iterator;

import sketch.util.Checker;

public class ForLoopIterator<T> implements Iterator<T>{

	private IGenerator<T> generator;
	
	public ForLoopIterator(IGenerator<T> generator) {
		Checker.checkNull(generator, "The generator could not be null!");
		this.generator = generator;
	}
	
	@Override
	public boolean hasNext() {
		return this.generator.hasNext();
	}

	@Override
	public T next() {
		return this.generator.next();
	}

	@Override
	public void remove() {
		throw new UnsupportedOperationException();
	} 

}
